package com.unhz.taigu.service.rolepermission.impl;

import com.unhz.generator.dao.SysRolePermissionMapper;
import com.unhz.generator.pojo.SysRolePermission;
import com.unhz.taigu.service.rolepermission.RolePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by cxg on 2017/11/14 0014.
 *
 * @Author 曹显贵
 * @Date 2017/11/14 0014 17:09
 */
@Service
public class RolePermissionServiceImpl implements RolePermissionService {

    @Autowired
    private SysRolePermissionMapper sysRolePermissionMapper;

    @Override
    public int deleteByRoleId(Integer roleId) {
        return sysRolePermissionMapper.deleteByRoleId(roleId);
    }

    @Override
    public int insertRolePermission(SysRolePermission rps) {
        return sysRolePermissionMapper.insertSelective(rps);
    }

    @Override
    public String deleteByPermissionId(Integer permissionId) {
        int count = sysRolePermissionMapper.deleteByPermissionId(permissionId);
        if(count > 0){
            return "success";
        }
        return "failed";
    }
}
